<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <input type="text" id="k" value="name">
    <input type="text" id="v" value="Jack">
    <input type="button" id="btn" value="test">
    <script>
    var k=document.getElementById('k');
    var v=document.getElementById('v');
    var btn=document.getElementById('btn');
    var o={};
    btn.oncllick=function(){
        o[k.value]=v.value;
        console.log(o);//输出结果：Odject{name:"Jack"}
    }
    </script>
</body>
</html>